$source = "E:\WORK\integrated-VideoCompress\ohos\entry\src\main\ets\dev"
$destination = "E:\WORK\VideoCompress\ohos\src\main\ets"
$engine = "D:\Downloads\ohos_debug_unopt_arm64-1806-windows-AMD64\src\out\ohos_debug_unopt_arm64"

# 检查目标目录是否存在
if (Test-Path -Path $destination) {
    # 删除目标目录
    Remove-Item -Path $destination -Recurse -Force
}

# 创建目标目录
New-Item -ItemType Directory -Path $destination

# 复制文件夹内容到目标目录
Copy-Item -Path $source -Destination $destination -Recurse

# 保存当前目录
Push-Location

# 切换到目标目录
Set-Location -Path E:\WORK\VideoCompress\example

# 执行命令
flutter run --local-engine=$engine

# 返回到原来的目录
Pop-Location